import type {RouteRecordRaw} from 'vue-router'
import {createRouter, createWebHashHistory} from 'vue-router'
import Index from "@/pages/index.vue";
import TeamPage from "@/pages/teamPage.vue";
import UserPage from "@/pages/userPage.vue";
import Search from "@/pages/search.vue";
import EditUserPage from "@/pages/editUserPage.vue";
import SearchResultPage from "@/pages/searchResultPage.vue";
import TeamAddPage from "@/pages/teamAddPage.vue";
import TeamSearchPage from "@/pages/teamSearchPage.vue";
import TeamUpdatePage from "@/pages/teamUpdatePage.vue";

export const menuRouter: Array<RouteRecordRaw> = [
    {path: '/', component: Index, meta: {title: '首页'}},
    {path: '/team', component: TeamPage, meta: {title: '找队伍'}},
    {path: '/user', component: UserPage, meta: {title: '个人主页'}},
    {path: '/search', component: Search, meta: {title: '找伙伴'}},
    {path: '/user/edit', component: EditUserPage, meta: {title: '编辑信息'}},
    {path: '/user/list', component: SearchResultPage, meta: {title: '搜索结果'}},
    {path: '/team/add', component: TeamAddPage, meta: {title: "加入队伍"}},
    {path: '/team/update', component: TeamUpdatePage, meta: {title: "更新队伍"}},
    {path: '/team/search', component: TeamSearchPage, meta: {title: "搜索队伍"}},
    {path: '/user/login', component: () => import('@/pages/userLoginPage.vue')},
    {path: '/:pathMatch(.*)*', redirect: '/'},
]


const routes: Array<RouteRecordRaw> = [...menuRouter];

const router = createRouter({
    history: createWebHashHistory(),
    routes,
});

export default router
